import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

let base = (function() {
  let path = location.pathname;
  if(/^\/wisdomSite/.test(path)) {
    return '/wisdomSite/';
  }
  return '/';
})();

export default new Router({
  mode: 'history',  // 线上配置，本地调试时需要 注释掉
  base: base,  // 线上配置，本地调试时需要 注释掉
  routes: [
    {
      path: '/Index',
      name: 'Index',
      component: () => import('../components/index')
    },
    {
      path: '/Staff',
      name: 'Staff',
      component: () => import('../components/Staff')
    },
    {
      path: '/Check',
      name: 'Check',
      component: () => import('../components/Check')
    },
    {
      path: '/Oversee',
      name: 'Oversee',
      component: () => import('../components/Oversee')
    },
    {
      path: '/CarRun',
      name: 'CarRun',
      component: () => import('../components/CarRun')
    },
    {
      path: '/Material',
      name: 'Material',
      component: () => import('../components/Material')
    },
    {
      path: '/Video',
      name: 'Video',
      component: () => import('../components/Video')
    },
    {
      path: '/Monitor',
      name: 'Monitor',
      component: () => import('../components/Monitor')
    },
    {
      path: '/DeviceDetailInfo/:id',
      name: 'DeviceDetailInfo',
      component: () => import('../components/DeviceDetailInfo'),
      props: true,
    },
    {
      path: '/TowerCrane',
      name: 'TowerCrane',
      component: () => import('../components/TowerCrane')
    },
    {
      path: "/Foundation",
      name: "Foundation",
      component: () => import("../components/Foundation")
    },
    {
      path: "/EnvironmentMonitor",
      name: "EnvironmentMonitor",
      component: () => import("../components/EnvironmentMonitor")
    },
    {
      path: "/OrganizeSystem",
      name: "OrganizeSystem",
      component: () => import("../components/OrganizeSystem")
    }
  ]
})
